<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

</body>
<script>
//原始数据
let results = [
  {"手机号":"13951130880","姓名":"高大山","入职日期":43535,"转正日期":43719,"工号":20089}
]
//目标数据
  //形成一个数组
  //里面就是每一个的员工属性
/*
let data = [
  {mobile: "13951130880",username: "高大山", timeOfEntry: 43535, correctionTime: 43719, workNumber: '20089'}
]
*/
//要写代码完成数据处理
//关注对哪些数据做哪些操作
//利用中间变量形成对应关系
let map = {
  '手机号': 'mobile',
  '姓名': 'username',
  '入职日期': 'timeOfEntry',
  '转正日期':  'correctionTime',
  '工号': 'workNumber'
}
//对象修改key
//对原来的对象属性替换
/*
results[0].mobile = results[0]['手机号']
delete results[0]['手机号']
console.log(results[0])
*/
//产生新的对象,新增属性
/*
let item = {}
item.mobile = results[0]['手机号']
*/
//久数组转换新数组
let data = results.map(t=> {
  let item = {}
  for (let key in t) {
    let newKey = map[key]
    item[newKey] = t[key]
  }
  return item
})
console.log(data)
</script>
</html>
